import { defineStore } from "pinia";

export const useUserStore = defineStore("user", {
  state: () => {
    return {
      userId:"",
      username:"",
      nickname:"",
      studentId:"",
      realName:"",
      email:"",
      phone:"",
      avatarUrl:"",
      role:"",
      status:"",
      createdAt:""
    };
  },
  getters: {
    // doubleCount: (state) => state.count * 2,
  },
  actions: {
    setInfo(data){
      console.log("***********************");
      console.log(data);
      console.log("***********************");
      this.$patch(data);
    }
  },
  persist: {
    key: 'user', // store 的存储键名
    storage: localStorage, // 存储方式
  }
});
